package com.cy.zs.hp.controller;

import com.cy.zs.hp.common.jsonResult.JsonResult;
import com.cy.zs.hp.model.HisDoctor;
import com.cy.zs.hp.service.IHisDoctorService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * <p>
 * 医师相关 前端控制器
 * </p>
 *
 * @author cgb2008
 * @since 2020-11-28
 */
@Slf4j
@RestController
@RequestMapping("/hp/hisDoctor")
public class HisDoctorController {
    @Autowired
    private IHisDoctorService iHisDoctorService;
    @RequestMapping("/doFindByDepartment/{department}")
    public JsonResult doFindByDepartment(@PathVariable String department){
        return new JsonResult(iHisDoctorService.findByDepartment(department));
    }
    @RequestMapping("/{doctorId}")
    public JsonResult doFindDoctorById(@PathVariable Integer doctorId){
        return new JsonResult(iHisDoctorService.findByDoctorId(doctorId));
    }
    @GetMapping("/findDepartment")
    public JsonResult findDepartment(){
        List<HisDoctor> department = iHisDoctorService.findDepartment();//查询所部门
        return new JsonResult(department);
    }
}
